/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Registro.java
 *
 * Created on 6/05/2009, 11:04:41 PM
 */
package gui;

import conexion.RmiServidor;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
//import org.jvnet.substance.SubstanceLookAndFeel;
//import org.jvnet.substance.watermark.SubstanceImageWatermark;
/**
 *
 * @author arquitectura
 */
public class EstadoServidor extends javax.swing.JFrame {

    RmiServidor rs;
    HomeAdmin gs;

    /** Creates new form Registro */
    public EstadoServidor(RmiServidor rs, HomeAdmin gs) {
        initComponents();

        xPnlFondo pnlFondo = new xPnlFondo(3);
        this.add (pnlFondo);
        this.pack();
        
        this.setSize(800, 625);
        this.setLocationRelativeTo(null);
        this.rs = rs;
        this.gs = gs;


    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btn_Aceptar = new javax.swing.JButton();
        btn_Actualizar1 = new javax.swing.JButton();
        btn_Cancelar = new javax.swing.JButton();
        cbEstadoServidor = new javax.swing.JCheckBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Estado Servidor");
        setBounds(new java.awt.Rectangle(0, 0, 0, 0));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setForeground(java.awt.Color.white);
        setMinimumSize(new java.awt.Dimension(800, 625));
        setResizable(false);
        setUndecorated(true);

        btn_Aceptar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/BTN_aceptar.png"))); // NOI18N
        btn_Aceptar.setText("Aceptar");
        btn_Aceptar.setBorderPainted(false);
        btn_Aceptar.setContentAreaFilled(false);
        btn_Aceptar.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/BTN_aceptar_roll.png"))); // NOI18N
        btn_Aceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_AceptarActionPerformed(evt);
            }
        });

        btn_Actualizar1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/volverahome.png"))); // NOI18N
        btn_Actualizar1.setText("Menu Principal");
        btn_Actualizar1.setBorderPainted(false);
        btn_Actualizar1.setContentAreaFilled(false);
        btn_Actualizar1.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/BTN_volverahome_roll.png"))); // NOI18N
        btn_Actualizar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_Actualizar1ActionPerformed(evt);
            }
        });

        btn_Cancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/BTN_cancelar.png"))); // NOI18N
        btn_Cancelar.setText("Cancelar");
        btn_Cancelar.setBorderPainted(false);
        btn_Cancelar.setContentAreaFilled(false);
        btn_Cancelar.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/BTN_cancelar_roll.png"))); // NOI18N
        btn_Cancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_CancelarActionPerformed(evt);
            }
        });

        cbEstadoServidor.setSelected(true);
        cbEstadoServidor.setText("Servidor Activo");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(194, 194, 194)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cbEstadoServidor)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btn_Actualizar1)
                        .addGap(18, 18, 18)
                        .addComponent(btn_Aceptar)))
                .addGap(36, 36, 36)
                .addComponent(btn_Cancelar)
                .addContainerGap(221, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(115, 115, 115)
                .addComponent(cbEstadoServidor)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 368, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_Actualizar1)
                    .addComponent(btn_Aceptar)
                    .addComponent(btn_Cancelar))
                .addGap(61, 61, 61))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-800)/2, (screenSize.height-600)/2, 800, 600);
    }// </editor-fold>//GEN-END:initComponents
    private void btn_CancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CancelarActionPerformed
        // TODO add your handling code here:
        this.dispose();
        //SubstanceLookAndFeel.setSkin("org.jvnet.substance.skin.CremeSkin");
        //SubstanceLookAndFeel.setCurrentWatermark("org.jvnet.substance.watermark.SubstanceBinaryWatermark");//Ejemplo de aplicacion de un watermark de Substance
        //SubstanceLookAndFeel.setCurrentWatermark(new SubstanceImageWatermark("http://72.29.81.246/~imindjav/images/HomeAdmin.jpg"));
        //SubstanceLookAndFeel.setImageWatermarkOpacity(new Float(1));
        gs.setVisible(true);
    }//GEN-LAST:event_btn_CancelarActionPerformed

    private void btn_AceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_AceptarActionPerformed
        // TODO add your handling code here:
        if (this.cbEstadoServidor.isSelected() == true) {
            try {
                rs.gestionServidor(true);
            } catch (RemoteException ex) {
                Logger.getLogger(EstadoServidor.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            try {
                rs.gestionServidor(false);
            } catch (RemoteException ex) {
                Logger.getLogger(EstadoServidor.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        this.dispose();
        //SubstanceLookAndFeel.setSkin("org.jvnet.substance.skin.CremeSkin");
        //SubstanceLookAndFeel.setCurrentWatermark("org.jvnet.substance.watermark.SubstanceBinaryWatermark");//Ejemplo de aplicacion de un watermark de Substance
        //SubstanceLookAndFeel.setCurrentWatermark(new SubstanceImageWatermark("http://72.29.81.246/~imindjav/images/HomeAdmin.jpg"));
        //SubstanceLookAndFeel.setImageWatermarkOpacity(new Float(1));
        gs.setVisible(true);
                 
                 
    }//GEN-LAST:event_btn_AceptarActionPerformed

    private void btn_Actualizar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_Actualizar1ActionPerformed
        // TODO add your handling code here:
        this.dispose();
        //SubstanceLookAndFeel.setSkin("org.jvnet.substance.skin.CremeSkin");
        //SubstanceLookAndFeel.setCurrentWatermark("org.jvnet.substance.watermark.SubstanceBinaryWatermark");//Ejemplo de aplicacion de un watermark de Substance
        //SubstanceLookAndFeel.setCurrentWatermark(new SubstanceImageWatermark("http://72.29.81.246/~imindjav/images/HomeAdmin.jpg"));
        //SubstanceLookAndFeel.setImageWatermarkOpacity(new Float(1));
        gs.setVisible(true);
    }//GEN-LAST:event_btn_Actualizar1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {

        //JFrame.setDefaultLookAndFeelDecorated(true);
        //SubstanceLookAndFeel.setSkin("org.jvnet.substance.skin.CremeSkin");
        //SubstanceLookAndFeel.setCurrentWatermark("org.jvnet.substance.watermark.SubstanceBinaryWatermark");//Ejemplo de aplicacion de un watermark de Substance
        //SubstanceLookAndFeel.setCurrentWatermark(new SubstanceImageWatermark("http://72.29.81.246/~imindjav/images/EstadoServidor.jpg"));
        //SubstanceLookAndFeel.setImageWatermarkOpacity(new Float(1));
    /*
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new EstadoServidor().setVisible(true);
    }
    });*/
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_Aceptar;
    private javax.swing.JButton btn_Actualizar1;
    private javax.swing.JButton btn_Cancelar;
    private javax.swing.JCheckBox cbEstadoServidor;
    // End of variables declaration//GEN-END:variables
}
